# 作者: 赵若云
# 2025年02月19日09时38分44秒
# 3478783573@qq.com

def use_str():
    str1 = ("Hello Python")
    for i in str1:
        print(i, end="")

    print()
    print(str1.find("ll"))  # 2
    print(str1.replace("l", "L", 1))

    str_list = str1.split()  # 默认空格为分割符
    print(str_list)
    print(type(str_list))

    print('-' * 50)
    str2 = 'hello\nworld\nhow are you\ntoday is a good day'
    str_list = str2.splitlines()  # 换行分割
    print(str_list)

    # 拼接
    str_result = ','.join(str_list)
    print(str_result)


# 反转
def str_reverse():
    str1 = ("hello")
    my_list = list(str1)
    my_list.reverse()
    print(''.join(my_list))


# str_reverse()

use_str()